package com.peter.design.pattern.proxy.simpleproxy;

/**
 * @Auther: 肖冬
 * @Date: 2020/7/26 19:41
 * @Description: 代理模式作用：增加 保护
 */
public class Proxy implements Subject {

    private Subject subject;

    public Proxy(Subject subject) {
        this.subject = subject;
    }

    @Override
    public void request() {
        before();
        subject.request();
        after();
    }


    public void before(){
        System.out.println("called before request().");
    }

    public void after(){
        System.out.println("called after request().");
    }
}
